// 设置相关仓库
import { defineStore } from "pinia";

export const useSettingStore = defineStore("setting", {
  state: () => ({
    // 侧边栏是否折叠
    isCollapse: false,
    // 侧边栏宽度
    asideWidth: "200px",
    // 侧边栏宽度
    asideWidthCollapse: "65px",
    // 主题
    theme: "light",
    color: "#409EFF",
    refresh: false, // 控制刷新效果
    isDraw: false, // 抽屉是否显示
    setFooter: true, // 控制底部是否显示
    setNav: true, // 控制导航栏是否显示
    setIcon: true, // 控制图标是否显示
    isDark: localStorage.getItem("vueuse-color-scheme") === "dark", // 控制暗黑主题
  }),
  actions: {
    setCollapse() {
      this.isCollapse = !this.isCollapse;
      // this.asideWidth = this.isCollapse ? this.asideWidthCollapse : "200px";
    },
    setRefresh() {
      this.refresh = !this.refresh;
    },
  },
  persist: true,
});
